<?php

  session_start();
  if ( isset($_POST['usr']) && isset( $_POST['pw'] ) && $_POST['usr'] && $_POST['pw'] ) {
    // For now, the user/password have to be the same and be at least 3 characters
    if ( ( $_POST['usr'] == $_POST['pw'] ) && strlen( $_POST['usr'] ) > 2 ) {
      $_SESSION['user'] = $_POST['usr'];

      header( "Location: index.php?msg=login" );

      exit();
    } else {
    	header( "Location: index.php?msg=authfail" );
    }
  } else {
  	header( "Location: index.php" );
  }

?>